<template>
    	<div class="spare-a">
			<div class="questions-ar">
				<div class="spare-ara">
					<div class="spare-ara-a clearfix">
						<div class="spare-ara-al">
							<div class="spare-ara-all"><input type="text" placeholder="请输入关键字" id="userSearch" v-model="userName"/></div>
							<div class="spare-ara-alr" @click="logSearch(userName)"></div>
						</div>
						<div class="spare-ara-ar">
						<!-- 	<router-link :to="{name:'SuperSearchLog'}" class="spare-tj" > 高级搜索
							</router-link> -->
                            <button class="spare-tj" @click="toSearch">高级搜索</button>
							<!-- <a href="javascript:void(0)" onclick="loadPage('ietm-log-search.html')" class="spare-tj" ></a> -->
						</div>
					</div>
					<div class="srcoll-documentation" id="srcoll-documentation">
					<div class="documentation paper">
						<ul class="lists" id="lists">
							<li v-for="data in datas" :key="data.id">
								<div class="spare-new"><div class="spare-newl">用户：{{data.userName}}</div> 
								<div class="spare-newl">行为：{{data.operation}}</div></div>
								<div class="spare-new"> <div class="spare-newl">日期时间：{{data.createDate}}</div>
								<div class="spare-newl">结果：<span style="color:#63dd00">{{data.result}}</span></div></div>
							</li>
						</ul>
					</div>
				</div>
			</div>
        </div>
	</div>
</template>

<script>
import IetmLog from '../../../store/log.js'
export default {
    data(){
        return{
			userName:'',
			datas:[],
			title:''
        }

	},
    methods:{
		logSearch(userName){
			this.axios.get("/ietm/log",{params:{userName:userName}}).then(res=>{
				this.datas = res.data.rows;
			})
        },
        toSearch(){
             this.$emit('returnflag',true);
        }

    },
    mounted(){
        IetmLog.$on('val',(data)=>{
            this.axios.get("/ietm/log",
                    {params:{userName:data.userName,
                            operation: data.operation,
                            startDate:data.startDate,
                            endDate:data.endDate
                            }}).then(res=>{
				this.datas = res.data.rows;
			})
        })
    },
    created(){
		this.logSearch('');
	}/* ,
	watch:{
		$route(to,from)
		{
			if(from.name=="SuperSearchLog")
			{
				this.axios.get("/ietm/log",{params:{userName:this.$route.params.userName,
					operation:this.$route.params.operation,
					startDate:this.$route.params.startDate,
					endDate:this.$route.params.endDate
				}}).then(res=>{
				this.datas = res.data.rows;
			})
			}
		}
	} */
}
</script>

<style scoped>
@import url('../../../assets/css/content.css');
@import url('../../../assets/css/animation.css');
</style>